﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MasterDetail.aspx.cs" Inherits="ZX.WebApp.MasterDetail" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>

    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/menu/assets/skins/sam/menu.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />  
      <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/reset-fonts-grids/reset-fonts-grids.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
   
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />

     <style type="text/css">
        .yui-skin-sam table 
        {
            margin:5px;    
        }
        
        .yui-skin-sam table td
        {
             height:25px;
        }         
        
        textarea 
        {
            height:100px;
        }
        
        label
        {
            font-size:14px;
            text-align:right;
            width:200px;
        }
       body
       {
            background: #eeeeee;
       }
     </style>
    <link rel="stylesheet" type="text/css" href="../Styles/default/calendar.css" />
    <link href="../Styles/base.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/formReForm.css" rel="stylesheet" type="text/css" />

    <script src="../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.upload.js" type="text/javascript"></script>
    <script src="../Scripts/CombinButton.js" type="text/javascript"></script>
    <!--end custom header content for this example-->
    <!-- Dependencies -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <!-- OPTIONAL: JSON Utility (for DataSource) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <!-- OPTIONAL: Connection Manager (enables XHR for DataSource) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <!-- OPTIONAL: Get Utility (enables dynamic script nodes for DataSource) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <!-- OPTIONAL: Drag Drop (enables resizeable or reorderable columns) -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <!-- OPTIONAL: Calendar (enables calendar editors) -->
    <%--<script type="text/javascript" src="../Scripts/yui_2.9.0/build/calendar/calendar-min.js"></script>--%>
    <!-- Source files -->
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>

    <script type="text/javascript" src="../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script type="text/javascript" src="../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
  
    <script src="../Scripts/formReForm.js" type="text/javascript"></script>
    <script src="../Scripts/Appjs/CheckModel.js" type="text/javascript"></script>

</head>
<body  class="yui-skin-sam">
    <form id="form1" runat="server">
        <div id="listpage">
            <div id="toolbar" style="margin: 2px;">
                    <button type="button" id="btnSave" name="btnSave">
                    保存</button><button type="button" id="btnReload" name="btnReload">
                    刷新</button> <button type="button" id="btnClose" name="btnClose">
                    关闭</button> 
            </div>
        <div class="fieldForm" id="fieldForm" >
           <asp:Literal ID="FormTemplate" runat="server"></asp:Literal>
        </div>
        <div id="data">
            <div id="Div1" style="margin: 2px;">
                   <button type="button" id="btnNew" name="btnNew">
                    新增</button>
                    <button type="button" id="btnSave2" name="btnSave2">
                    保存</button>
           </div>
           <div id="json"></div>
        </div>
    </div> 
    </form>
    <form id="form2" style="display:none" action="AjaxData/DataSave.aspx">
        <textarea style="display: none" id="jsonDataContent" rows="2" cols="2" name="jsonDataContent"></textarea>
    </form>
   <!-- 对话框 -->
    <div id="dialogArea" style="display:none">
    <div id="dialog1" class="yui-pe-content"  >
        <div class="hd">
           数据编辑</div>
        <div class="bd">
            <iframe id="EditUIWindow" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
        
    <div id="dialog2" class="yui-pe-content" >
        <div class="hd">
            选择基本信息:</div>
        <div class="bd">
            <iframe id="EditUIWindow1" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
    <div id="dialog3" class="yui-pe-content"  >
        <div class="hd">
            提示</div>
        <div class="bd">
            你正在删除当前选择的数据，继续请按确定？
        </div>
    </div>
 
    <div id="dialog4" class="yui-pe-content">
        <div class="hd">
            查询</div>
        <div class="bd">
           <iframe id="QueryWindow" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
    
    <div id="dialog5" class="yui-pe-content" >
        <div class="hd">
          数据详情</div>
        <div class="bd">
            <iframe id="EditUIWindow3" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
    </div>
</body>
<script type="text/javascript">
        (function () {
            var Dom = YAHOO.util.Dom,
            Event = YAHOO.util.Event;

            Event.onDOMReady(function () {
                var layout = new YAHOO.widget.Layout({
                    units: [
                    { position: 'top',height: 35, body: 'toolbar', gutter: '1 1 1 1', scroll: null, zIndex: 2 },
                    //{ position: 'left', header: '功能模块', width: 250, body: 'left', gutter: '1 5 1 1', collapse: true, scroll: true, zIndex: 1, resize: true },
                    {position: 'center', body: 'fieldForm', gutter: '1 1', scroll: true },
                    { position: 'bottom', height: 300, body: 'data', gutter: '1 1'}
                ]
                });
                layout.render();
            });
        })();
        YAHOO.example.init = function () {
        // "click" event handler for each Button instance
        function onButtonClick(p_oEvent) {
                 YAHOO.log("You clicked button: " + this.get("id"), "info", "example1");
                 switch(this.get("id"))
                 { 
                    case "btnSave": 
                         alert("save");
                         fnSave();
                         break;
                    case "btnSave2": 
                         fnSave();
                         break;
                    case "btnClose":
                         fnAddMasterDetail();
                         break;
                    case "btnReload":
                         fnReload();
                         break;
                    case "btnNew":
                         fnNew();
                         break;
                    default:
                         break;
                 }                        
        }


        YAHOO.util.Event.onContentReady("toolbar", function () {

        var btnSave = new YAHOO.widget.Button("btnSave");
        btnSave.on("click", onButtonClick);
        var btnSave2 = new YAHOO.widget.Button("btnSave2");
        btnSave2.on("click", onButtonClick);
        var btnClose = new YAHOO.widget.Button("btnClose");
        btnClose.on("click", onButtonClick);
        var btnNew = new YAHOO.widget.Button("btnNew");
        btnNew.on("click", onButtonClick);
        var btnReload = new YAHOO.widget.Button("btnReload");
        btnReload.on("click", onButtonClick);
        });
    }();


        var url = "AjaxData/DataSave.aspx",
        entity = "<% =EntityName %>",//实体对象
        action = '<% =DataAction %>',//操作方式
        Parent = parent;//父类页面
        <asp:Literal ID="EditTemplate" runat="server"></asp:Literal>
        <asp:Literal ID="MasterID" runat="server"></asp:Literal>

      ///------------------------------------
      //系统的保存方法
      ///------------------------------------
      function setValue()
      {
          <asp:Literal ID="jSave" runat="server"></asp:Literal>    
      }

       ///初始化相关信息
       $(document).ready(function() {
           <asp:Literal ID="jInitControl" runat="server"></asp:Literal>
           ///编辑状态
           if(getPar1("id")!="")
           {
               $("#form1").JSONToForm($.toJSON(instance[0]));
           }
           showMessage();
       });
</script>
<script src="../Scripts/yui.edit.common.js" type="text/javascript"></script>
<script src="../Scripts/appjs/model.<% =EntityName %>.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript">
    var const_entityID = "<% =EntityId %>",    //实体ID名称
        const_entityName = "<% =SubEntityName %>",//实体名称
        const_EditEntity = "<% =EditEntity %>",//编辑实体名
        const_functionId   ="<% =FunctionID %>",//自定义条件
       
        //const_Order ="< =Order >",           //排序  
        const_DataFields = [<% =DataFields %>],
        //const_DataColums = [<% =DataColums %>],
        const_DataColums = ['GoodsID','iSun_Selected','EmpID','GoodsName','Total','iSun_IsNew'],
        const_UserId = "<% = UserId %>",   
        //const_BlankInstance = [{"GoodsID":"00000000-0000-0000-0000-000000000000","EmpID":"00000000-0000-0000-0000-000000000000","GoodsName":null,"Total":0,"iSun_Selected":false,"iSun_IsNew":true}],
        const_BlankInstance = [<% =BlankInstance %>],  //
        initialRequestUrl = "entity=" + const_entityName + "&r="+Math.random();
</script>
<script src="../Scripts/yui.list.MasterDetail.Edit.list.common.js"  type="text/javascript"></script>

<script type="text/javascript" language="javascript">
    //调用初始化控件功能
    if (typeof (fnInitControl) == "function") {
        fnInitControl();
    }
    window.document.getElementById("dialogArea").style.display = "";
</script>
</html>
